home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
eflibpt4.zip
/
DEMO
/
STREAMS
/
POLYSTRM.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1996-08-16
|
1KB
|
26 lines
{ Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
Demonstration; polymorphic data streams
EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED. }
uses EFLIBIO;
var FirstStream, SecondStream : StreamObjectPointerType;
begin
FirstStream := New (MemoryStreamObjectPointerType, Initialize (100));
SecondStream := New (NullStreamObjectPointerType, Initialize);
{ The first stream and the second stream uses the same interface, ie.
allows the same operations to be performed. They are polymorphic.
Object polymorphism makes it possible to pass any stream to a
component. The component then can access the stream without knowing
anything about the stream implementation. »How» the expected
operations are performed is not of interest. }
FirstStream^.Free; SecondStream^.Free;
end.